<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a=12;
        var b="你好";
        var c=true;
        var d;
        var e=null;
        var f={}
        var g=function(){

        }
       // console.log(typeof d);
        //console.log(typeof e); //null是对象类型
        //console.log(typeof g); //函数是函数类型
        //  数据转换
        //数字转化
        // var a1= Number(12);
        // var a2=Number(true);
        // var a3=Number(null);
        // var a4=Number(undefined);
        // var a5=Number("12");
        // var a5=Number("abc12");
        // var a6=Number("-12");
        // var a7=Number("  0xf");
        // console.log(a1);
        // console.log(a2);
        // console.log(a3);
        // console.log(a4);
        // console.log(a5);
        // console.log(a6);
        // console.log(a7);
        //字符串转化
        //var b1=12.toString()//这是错误的 数字的string要有变量接受
        var num=12;
        var b1=num.toString();
        var b2=true.toString();
        var b3=String(null);
        var b4=String(undefined);
        var b5={}.toString();
        var b6=[12,[45,"你好"]].toString();
        function add(){
            console.log("我在求和");
        }
        var b7=add.toString();
        console.log(b1);
        console.log(b2);
        console.log(b3);
        console.log(b4);
        console.log(b5);
        console.log(b6);
        console.log(b7);
        //boolean的错误类型(7)
        // NaN 0
        // " " ' '
        // false
        // null
        // undefined
        console.log(Boolean(NaN));
         console.log(Boolean(0));
         console.log(Boolean(""));
         console.log(Boolean(''));
         console.log(Boolean(false));
         console.log(Boolean(null));
         console.log(Boolean(undefined));



         var number=parseInt(12.23);
         var number1=parseInt(" - 12.23");
         console.log(number);
         console.log(number1);
         var number2=parseFloat(12.23);
         var number3=parseFloat(" -12.20012 3" );
         console.log(number2);
         console.log(number3);
    </script>
</body>
</html>